// src/main/java/com/example/coursehub/repository/ClassesTeacherRepository.java
package com.example.coursehub.repository;

import com.example.coursehub.entity.ClassesTeacher;
import com.example.coursehub.entity.ClassesTeacherId; 
import com.example.coursehub.entity.Classes;
import com.example.coursehub.entity.User; 
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;

public interface ClassesTeacherRepository extends JpaRepository<ClassesTeacher, ClassesTeacherId>, JpaSpecificationExecutor<ClassesTeacher> {

    Optional<ClassesTeacher> findByClasses_ClassesIdAndUser_UserId(String classesId, String userId);

    List<ClassesTeacher> findByClasses(Classes classes);
    List<ClassesTeacher> findByClasses_ClassesId(String classesId);
    void deleteByClasses_ClassesIdAndUser_UserId(String classesId, String userId);

    List<ClassesTeacher> findByUser(User user);
}